package com.yu.admin.modules.app.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yu.admin.modules.app.pojo.OrderInfoAdmin;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 订单
 */
public interface OrderInfoAdminMapper extends BaseMapper<OrderInfoAdmin> {

    // 更新订单状态，和交易号
    @Update("UPDATE order_info SET order_status = #{param3}, wx_pay_transaction_id = #{param2}, pay_price=#{param4} \n" +
            "WHERE order_no = #{param1}; ")
    void updateOrderStatus(String orderNo, String wxPayTransactionId, String orderStatus, Integer payPrice);

    @Select("SELECT order_no FROM order_info \n" +
            "WHERE order_status = #{param1} \n" +
            "ORDER BY create_time DESC LIMIT #{param2}; ")
    List<String> selectByOrderStatusLimit(String orderStatus, int limit);
}
